#include<stdio.h>
#include<string.h>

int main() {
	int k;
	scanf("%d",&k);
	char input[10];
	char output[10];
	for(int cnt=1;scanf("%s",&input),strcmp(input,"End");cnt++)
	{
		if(cnt%(k+1)==0) strcpy(output,input);
		else if(!strcmp(input,"JianDao")) strcpy(output,"ChuiZi");
		else if(!strcmp(input,"ChuiZi"))  strcpy(output,"Bu");
		else if(!strcmp(input,"Bu"))      strcpy(output,"JianDao");
		printf("%s\n",output);
	}
	return 0;
}

